#ifndef LIBXCOM_EXPRESS_H
#define LIBXCOM_EXPRESS_H

#include "cmdvalue.h"
#include "data.h"
#include "operator.h"
#include "opvalue.h"
#include <memory>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <utils/logger.h>
#include <vector>

namespace libxcom {
class Express {
public:
    Express(const OpItem &op);
    virtual ~Express();

    void Insert(std::shared_ptr<Express> expr);
    void Add(std::shared_ptr<Express> expr);
    std::shared_ptr<Express> ChildAt(int index);

    int32_t ChildrenSize();

    OP_TYPE Type();

    inline OpItem &Value();
    inline std::string VarName();
    inline char VarPrefix();
    std::string exprStr();
    std::string funcName();
    OpValue GenCmd(Operator &iOperator);

    OpValue ParseCmd(Operator &iOperator, int32_t pos = 0, const CmdValue &recvCmd = CmdValue::Null());
    TYPE_DEFINE ResultType(Operator &op);

private:
    OpItem opItem;
    std::vector<std::shared_ptr<Express>> children;
};
} // namespace libxcom
#endif // LIBXCOM_EXPRESS_H